import logging

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

from config.config import *


def get_driver():
    driver=None
    if BROWSER_TYPE=="chrome":
        driver=get_chrome_driver()
    if BROWSER_TYPE=="edge":
        driver=get_edge_driver()

    return driver

def get_chrome_driver():
    options=webdriver.ChromeOptions()
    options.add_argument("--start-maximized")
    options.add_argument("--headless") if HEADLESS else None

    if DRIVER_TYPE=="local":
        service=Service(CHROME_DRIVER_PATH)
    else:
        service=Service("ChromeDriverManage()")#这里有问题
    driver=webdriver.Chrome(service=service,options=options)
    logging.info("启动谷歌浏览器")
    return driver

def get_edge_driver():
    pass
